/*
 * @Description: jishupu-admin-template
 * @Author: 技术铺<jishupu@qq.com>
 * @Date: 2022-03-03
 */
const { success } = require('./utils')

// 角色模块
module.exports = [
  // 列表
  {
    url: '/v1/role$',
    type: 'get',
    response: config => {
      const result = {
        'items': [
          {
            'id': 1,
            'name': '高级管理员',
            'description': '',
            'sort': 1,
            'status': 1,
            'created_at': '2021-12-29 00:00:00',
            'updated_at': '2022-02-28 15:56:52'
          },
          {
            'id': 2,
            'name': '编辑人员',
            'description': '内容发布',
            'sort': 2,
            'status': 1,
            'created_at': '2021-12-29 00:00:00',
            'updated_at': '2022-02-28 16:14:02'
          },
          {
            'id': 11,
            'name': '演示角色',
            'description': '',
            'sort': 3,
            'status': 1,
            'created_at': '2021-12-29 00:00:00',
            'updated_at': '2022-02-28 16:14:31'
          }
        ],
        'meta': {
          'current_page': 1,
          'last_page': 1,
          'per_page': '20',
          'total': 3
        }
      }
      return success(result)
    }
  },
  // 详情
  {
    url: '/v1/role/\\d+$',
    type: 'get',
    response: config => {
      const result = {
        'id': 11,
        'name': '演示角色',
        'description': '',
        'status': 1,
        'menu_permission_ids': {
          '5': [],
          '6': [
            109,
            101,
            103,
            96,
            111
          ],
          '28': [],
          '29': [
            141,
            143
          ],
          '37': [],
          '38': [
            91,
            93
          ],
          '50': [],
          '51': [
            85
          ],
          '53': [],
          '54': [],
          '56': [],
          '57': [
            123
          ],
          '58': [],
          '60': [
            125
          ],
          '63': [],
          '64': [
            130
          ],
          '65': [],
          '67': [
            132
          ],
          '72': [],
          '73': [],
          '74': [
            116
          ],
          '75': [],
          '77': [
            118
          ],
          '82': [
            137
          ],
          '85': [
            36
          ],
          '89': [],
          '90': [],
          '91': [],
          '92': [],
          '93': [],
          '94': [
            43
          ],
          '95': [],
          '97': [
            45
          ],
          '103': [
            76,
            174
          ],
          '104': [],
          '109': [
            78
          ],
          '110': [
            53,
            55
          ],
          '119': [
            83
          ],
          '120': [
            175
          ],
          '121': [
            60
          ],
          '122': [],
          '124': [
            62
          ],
          '127': [],
          '128': [
            67
          ],
          '129': [],
          '131': [
            69
          ],
          '160': [],
          '165': [],
          '166': [
            168,
            170
          ]
        },
        'category_ids': [
          1,
          2,
          3,
          4,
          5,
          6
        ]
      }
      return success(result)
    }
  },
  // 添加
  {
    url: '/v1/role$',
    type: 'post',
    response: config => {
      return success({}, '添加成功')
    }
  },
  // 修改
  {
    url: '/v1/role/\\d+$',
    type: 'put',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟修改状态
  {
    url: '/v1/role/\\d+/status',
    type: 'patch',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟删除
  {
    url: '/v1/role/\.*',
    type: 'delete',
    response: config => {
      return success({}, '删除成功')
    }
  },
  // 用户模块-角色列表
  {
    url: '/v1/role/user-role-config$',
    type: 'get',
    response: config => {
      const result = {
        'items': [
          {
            'id': 1,
            'name': '高级管理员'
          },
          {
            'id': 2,
            'name': '编辑人员'
          },
          {
            'id': 11,
            'name': '演示角色'
          }
        ]
      }
      return success(result)
    }
  },
  // 模拟排序
  {
    url: '/v1/role/sort',
    type: 'put',
    response: config => {
      return success({}, '修改成功')
    }
  }
]
